home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
011
/
pmap126.arc
/
PMAP.DOC
next >
Wrap
Text File
|
1987-05-10
|
19KB
|
432 lines
PMAP 1.26
---------
PMAP (Program MAP) is a simple program that displays how your
PC's memory is being used. It lists all active programs
(including resident programs such as Sidekick and PCED) and
tells you how much free memory is available for programs. If
expanded (LIM) memory is present, a summary of EMS use is also
shown.
| indicates new or changed features for the latest version of
PMAP. See also version history below.
Syntax summary
--------------
| pmap [proglist] (display memory usage)
| pmap [proglist] /d (display detailed memory usage)
pmap /r (display raw memory allocation chain)
Standard display
----------------
When PMAP is invoked without parameters, you'll see a display
like this:
Addr Program Parent Parameters Blks Size Vectors
---- ------- -------- ----------- ---- ------- -------
1470 command command 2 3632 22 23 24 2E
155C rxintmgr command 2 1408 60
15B6 sdump command 2 2816 05
1666 kbfix2 command /KT1 /D0... 2 2560 08 09 16
1708 fastvr command 2 576
172E ced command ?? 2 26976 1B 61
1DC6 raw command ?? 2 688
1DF4 cache-em command /1312 /t 2 28848 13 19 21
Total conventional free memory 1 503888
Extended memory installed 393216
Largest conventional free block 503888
Next program will load at 2500
Each program that is currently in memory is displayed. Fields
are as follows:
Addr The memory segment at which the program is
loaded, in hexadecimal.
Program The name of the program, if available. "??"
indicates that the name is not available. The
program name is never available under DOS 2.x.
Parent The name of the program's "parent". In most
cases, this will be "command", because most
programs are run by COMMAND.COM (i.e., from
the DOS prompt). See below.
Parameters The command line parameters that were specified
when the program was run. Some programs re-use
the area where the parameters are stored, in
which case a "??" will be displayed. An
ellipsis ("...") at the end indicates that there
were more parameters than could fit here.
Blocks The number of memory blocks that are owned by
the program.
Size The total size of all blocks owned by the
program.
Vectors A list of 80x8x interrupt vectors that appear to
have been "intercepted" by the program.
For example, the program KBFIX2 is loaded at memory segment
1666H and was run directly from the DOS prompt. The original
parameters were "/KT1 /D0" and there were more parameters than
can be shown here. DOS has allocated two blocks of memory for
the program, and they total 2560 bytes in size. Vectors 8
(timer tick), 9 (keyboard interrupt), and 16 (keyboard service)
have been "intercepted" by KBFIX2.
At the end of the list, PMAP indicates the number of blocks of
free memory, the total size of all free blocks, the largest
single free block, and the segment address at which the next
program will probably load.
| The amount of extended memory (AT memory above the 1 megabyte
| mark) is displayed only if such memory is present.
|
| You can restrict the display to certain programs by naming them
| on the command line. For example,
|
| pmap sdump ced
|
| would display information for the SDUMP and CED programs, and no
| others. The summary and expanded memory information is always
| displayed.
NOTE: "below" the first program loaded in memory (usually
COMMAND.COM), there is a block of memory allocated by DOS for
device drivers, etc. PMAP does not show this block in its
standard display. If you are interested to see how large it is
and where it is allocated, use the /R display described below,
in which it will be the first block listed; it will usually show
0008 in the "owner" field.
Detail display
--------------
When you run PMAP with the /D (Detail) parameter, you'll see the
same display, except that PMAP will show a detailed list of
memory blocks allocated for each program. For example:
Addr Program Parent Parameters Blks Size Vectors
---- ------- -------- ------------------ ------- -------
1666 kbfix2 command /KT1 /D0... 2 2560 08 09 16
1661 Environment 64
1666 Program 2496
KBFIX2 has two memory blocks allocated to it; PMAP shows the
size of each block and its address, and makes an educated guess
as to what the block is used for.
| You may include a list of specific programs to be displayed:
|
| pmap sdump ced /d
PMAP also displays a detail list of all free blocks of memory.
Raw display
-----------
When you run PMAP with the /r (Raw) parameter, you'll see a
display like this:
T MCB Addr Owner Para Bytes
- ---- ---- ----- ---- --------
M 0974 0975 0008 0AFA 44960
M 146F 1470 1470 00C3 3120
M 1533 1534 1470 0020 512
[more of the same]
M 1DF3 1DF4 1DF4 0706 28768
M 24FA 24FB 2500 0004 64 [pmap]
M 24FF 2500 2500 1376 79712 [pmap]
Z 3876 3877 0000 6789 424080
This is an uninterpreted list of all blocks of memory allocated
by DOS (see below). The fields are as follows:
Type The block type. There are only two block types,
type M and type Z. The last block in the
chain is type Z, and all others are type M.
MCB The segment address of the Memory Control Block
(sometimes known as an arena header).
Addr The segment address of the memory block itself.
This is always equal to the MCB address plus
one.
Owner The segment address of the program that "owns"
the block of memory. If this is 0000, the block
is unallocated or "free".
Para The size of the block, in paragraphs (16 bytes).
Bytes The size of the block, in bytes.
All numbers are hexadecimal except "bytes", which is decimal.
The [pmap] suffix after an allocated block indicates that the
block is being used by PMAP. When PMAP terminates, this block
will be free (unallocated). The standard (non-Raw) PMAP display
understands this, and displays the map as if PMAP weren't there.
| If the /R switch is included, all other command line parameters
| are ignored.
Expanded memory display
-----------------------
If expanded (LIM-EMS, or EEMS) memory is present, PMAP always
displays EMS allocation as follows:
Expanded memory summary:
Block Size
----- -------
0 98304
1 1409024
Free 0
Total 1507328
Page frame segment: CC00h
Like standard DOS memory, EMS memory is allocated in blocks.
However, no information is easily available regarding the blocks
except their sizes, so that is all that is displayed.
EMS memory uses a "page frame" that maps a 64K block (actually,
four 16K "pages") of EMS memory into standard 80x8x memory.
The segment to which this memory is mapped is also displayed.
Interrupt vectors
-----------------
Many times interrupts are "intercepted" by more than one
resident program. PMAP will only show a vector attached to the
LAST program that intercepted it. For example, KBFIX2 shows
that it has intercepted vectors 8, 9, and 16. However, RXINTMGR
and SDUMP could also have intercepted any or all of these three
vectors, and PMAP would not know about that.
PMAP assumes that any vector that points into memory owned by a
program has been intercepted by that program. That is not
always true, so you may occasionally see spurious vectors
attached to a program.
More about parents
------------------
Every program has a "parent"; if program B was executed by
program A, then A is B's parent. In most cases, the parent will
be COMMAND.COM, because most PC programs are executed by
COMMAND.COM.
However, any program can execute any other program (assuming
that there is sufficient memory, etc.). This is how "shells"
work. For example, current versions of WordPerfect and many
other programs allow you to "exit to DOS"; what they usually do
is execute COMMAND.COM, which then displays a DOS prompt and
allows you to enter any commands that you wish. If you run
PMAP, you will see two copies of COMMAND.COM in memory.
However, you may notice that the second copy of COMMAND.COM
shows COMMAND.COM as its parent. Logically, you would expect
the parent to be (in this case) WordPerfect. Unfortunately,
some versions of COMMAND.COM (the one that comes with DOS 3.2,
for example) fool around with the area of memory that PMAP uses
to find the parent's address; rather than having the parent's
address, COMMAND.COM puts its own address there. In effect,
COMMAND.COM is always its own parent.
In general, programs that allow you to execute other programs
can use one of two methods: they can execute the other programs
directly, or the can execute COMMAND.COM and ask it to run the
requested program. If the former, PMAP will show the true
parent; if the latter, PMAP will show COMMAND.COM, and
COMMAND.COM will be its own parent.
Here is part of a PMAP display that shows a direct-execution
under DOS 3.2:
Addr Program Parent Blks Size Vectors
---- ------- -------- ---- ------- -------
...
3222 xced command 2 26016
387E qe xced 3 97232
503E command command 3 3488 22 23 24
...
The XCED program was run by COMMAND.COM (from the DOS prompt).
It then ran the program QE directly, i.e., without reloading
COMMAND.COM. Finally, a "shell" exit was taken from QE, which
did reload COMMAND.COM; notice that COMMAND shows as its own
parent.
Multi-tasking/task-switching programs
-------------------------------------
... play havoc with the memory allocation chain. PMAP may
not yield very much useful information under such programs.
DOS's memory allocation chain
-----------------------------
This information is almost totally undocumented by Microsoft, so
take it for what's it's worth. It's provided for informational
purposes only, and could vary from DOS version to DOS version.
DOS (version 2.00 or later) manages memory as a chain of
"blocks". Each block begins on a paragraph boundary, can be (in
theory) almost a megabyte in size, and is preceded immediately
by a 16-byte Memory Control Block (MCB), sometimes known as an
"arena header". The lowest (the 80x8x interrupt vectors, BIOS
and DOS data areas, DOS itself, device drivers, etc.) and
highest (video buffers, ROM modules) portions of memory are not
mapped, but the rest of memory is. Thus, memory can be pictured
like this:
paragraph contents
---------
0000 low memory (unmapped)
first MCB (16 bytes)
first memory block
next MCB
next memory block
...
last MCB
last memory allocation block
nnnn end of DOS memory (640K, for example)
The address of the first MCB will vary, depending on your
version of DOS, and the number and size of device drivers,
buffers, stacks, etc., that you loaded via CONFIG.SYS. In all
current versions of DOS (through 3.21), the segment address of
the first MCB can be obtained via DOS function 52H. On return
from this function, the address of the first MCB is located at
ES:[BX-2]. Here is sample code that returns the address of the
first MCB in AX:
mov ah,52H
int 21H
mov ax,es:[bx-2]
The MCB itself is a 16-byte region of memory that with fields as
follows:
Offset Size Contents
------ ---- --------
0 Byte 'M': this is not the last MCB
'Z': this is the last MCB
anything else: memory control blocks
destroyed. DOS will politely crash.
1 Word The segment address of the program that owns
this block of memory (the program's PSP).
3 Word The size of the block, in paragraphs
5-15 Reserved
This structure provides all of the information needed to step
through the memory allocation chain. A basic algorithm is as
follows:
Set MCB = segment of first MCB (as described above)
Do Until byte (MCB:0) = 'Z'
If byte (MCB:0) isn't 'M' or 'Z',
Then there's a big problem
Block_owner = word (MCB:1)
Block_size = word (MCB:3)
MCB = MCB + block_size + 1
End
EMS and EEMS memory is not, of course, mapped by DOS.
For more complete detail about DOS's memory allocation, see
"Managing Memory" by William J. Redmond in PC Tech Journal,
August, 1984 (Vol. 2, No. 2).
Version 1.26
------------
Corrects a problem detecting extended memory with certain
versions of BIOS ROM.
Version 1.25
------------
Adds the extended memory display and the selective display
option.
Corrects a minor problem with DOS 3.3.
Version 1.21
------------
Bug fixes to version 1.20:
1. No more runaway display when EMS memory is present but none
of it is in use.
2. PMAP is more careful about what it thinks is the name of the
command shell.
Copyright/License/Warranty
--------------------------
This document and the program file PMAP.EXE ("the software") are
copyrighted by the author. The copyright owner hereby licenses
you to: use the software; make as many copies of the program and
documentation as you wish; give such copies to anyone; and
distribute the software and documentation via electronic means.
There is no charge for any of the above.
However, you are specifically prohibited from charging, or
requesting donations, for any such copies, however made; and
from distributing the software and/or documentation with
commercial products without prior permission. An exception is
granted to not-for-profit user's groups, which are authorized to
charge a small fee (not to exceed $7) for materials, handling,
postage, and general overhead. NO FOR-PROFIT ORGANIZATION IS
AUTHORIZED TO CHARGE ANY AMOUNT FOR DISTRIBUTION OF COPIES OF
THE SOFTWARE OR DOCUMENTATION, OR TO INCLUDE COPIES OF THE
SOFTWARE OR DOCUMENTATION WITH SALES OF THEIR OWN PRODUCTS.
THIS INCLUDES A SPECIFIC PROHIBITION AGAINST FOR-PROFIT
ORGANIZATIONS DISTRIBUTING THE SOFTWARE, EITHER ALONE OR WITH
OTHER SOFTWARE, AND CHARGING A "HANDLING" OR "MATERIALS" FEE OR
ANY OTHER SUCH FEE FOR THE DISTRIBUTION. NO FOR-PROFIT
ORGANIZATION IS AUTHORIZED TO INCLUDE THE SOFTWARE ON ANY MEDIA
FOR WHICH MONEY IS CHARGED. PERIOD.
There is no restriction on the use of this software in
commercial or institutional environments.
No copy of the software may be distributed or given away without
this document; and this notice must not be removed.
There is no warranty of any kind, and the copyright owner is not
liable for damages of any kind. By using this free software,
you agree to this.
The software and documentation are:
Copyright (C) 1986, 1987 by
Christopher J. Dunford
10057-2 Windstream Drive
Columbia, Maryland 21044
(301) 992-9371